﻿<?php
// 连接数据库
mysql_connect("localhost","root","root");
mysql_query("set names gbk "); 
// 执行sql语句
$query="insert into user values('','$user_id','$user_password','$user_real_name','$user_email') ";
$result = mysql_db_query("psychology","$query");
$query2="select * from user where user_id = '$user_id' and user_password = '$user_password'";
$result2 = mysql_db_query("psychology","$query2");
$data= mysql_fetch_object($result2);

?>
<div id="">
	<h2>恭喜<?php echo $data->user_real_name ;?>注册成功</h2>
	<span id="time">5</span>秒后自动跳转
	<h3>点击<a href="login.php">登录</a>自动跳转</h3>
</div>
<!-- JS控制页面自动跳转的时间以及动态的显示还要等待的时间 -->
<script type="text/javascript">
	var wait_time = 4;
	setTimeout("window.open('login.php','_self','')",wait_time*1000);
	setInterval(op,1000);
	function op(){
		document.getElementById("time").innerHTML = wait_time;
					wait_time--;
	}
</script>